//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import Foundation
import SotoCore

extension EC2InstanceConnect {
    // MARK: Enums

    // MARK: Shapes

    public struct SendSSHPublicKeyRequest: AWSEncodableShape {
        /// The availability zone the EC2 instance was launched in.
        public let availabilityZone: String
        /// The EC2 instance you wish to publish the SSH key to.
        public let instanceId: String
        /// The OS user on the EC2 instance whom the key may be used to authenticate as.
        public let instanceOSUser: String
        /// The public key to be published to the instance. To use it after publication you must have the matching private key.
        public let sSHPublicKey: String

        public init(availabilityZone: String, instanceId: String, instanceOSUser: String, sSHPublicKey: String) {
            self.availabilityZone = availabilityZone
            self.instanceId = instanceId
            self.instanceOSUser = instanceOSUser
            self.sSHPublicKey = sSHPublicKey
        }

        public func validate(name: String) throws {
            try self.validate(self.availabilityZone, name: "availabilityZone", parent: name, max: 32)
            try self.validate(self.availabilityZone, name: "availabilityZone", parent: name, min: 6)
            try self.validate(self.availabilityZone, name: "availabilityZone", parent: name, pattern: "^(\\w+-){2,3}\\d+\\w+$")
            try self.validate(self.instanceId, name: "instanceId", parent: name, max: 32)
            try self.validate(self.instanceId, name: "instanceId", parent: name, min: 10)
            try self.validate(self.instanceId, name: "instanceId", parent: name, pattern: "^i-[a-f0-9]+$")
            try self.validate(self.instanceOSUser, name: "instanceOSUser", parent: name, max: 32)
            try self.validate(self.instanceOSUser, name: "instanceOSUser", parent: name, min: 1)
            try self.validate(self.instanceOSUser, name: "instanceOSUser", parent: name, pattern: "^[A-Za-z_][A-Za-z0-9\\@\\._-]{0,30}[A-Za-z0-9\\$_-]?$")
            try self.validate(self.sSHPublicKey, name: "sSHPublicKey", parent: name, max: 4096)
            try self.validate(self.sSHPublicKey, name: "sSHPublicKey", parent: name, min: 256)
        }

        private enum CodingKeys: String, CodingKey {
            case availabilityZone = "AvailabilityZone"
            case instanceId = "InstanceId"
            case instanceOSUser = "InstanceOSUser"
            case sSHPublicKey = "SSHPublicKey"
        }
    }

    public struct SendSSHPublicKeyResponse: AWSDecodableShape {
        /// The request ID as logged by EC2 Connect. Please provide this when contacting AWS Support.
        public let requestId: String?
        /// Indicates request success.
        public let success: Bool?

        public init(requestId: String? = nil, success: Bool? = nil) {
            self.requestId = requestId
            self.success = success
        }

        private enum CodingKeys: String, CodingKey {
            case requestId = "RequestId"
            case success = "Success"
        }
    }
}
